package com.mgr.service.impl;

import java.util.Random;

import org.springframework.stereotype.Service;

import com.mgr.service.SmsService;

@Service
public class SmsServiceImpl implements SmsService{

	@Override
	public String createOTP() {
		char[] chars = "1234567890abcdefghijklmnopqrstuvwxyz".toCharArray();
		StringBuilder sb = new StringBuilder();
		Random random = new Random();
		for (int i = 0; i < 5; i++) {
			char c = chars[random.nextInt(chars.length)];
			sb.append(c);
		}
		return sb.toString();
	}

	@Override
	public boolean verifyOTP(String inputString, String systemString) {
		return systemString.equals(inputString);
	}

	@Override
	public String createPassword() {
		char[] chars = "1234567890MNGHYOSDAZXCLPIOWQMGSA".toCharArray();
		StringBuilder sb = new StringBuilder();
		Random random = new Random();
		for (int i = 0; i < 10; i++) {
			char c = chars[random.nextInt(chars.length)];
			sb.append(c);
		}
		return sb.toString();
	}

}
